package com.sky.myapplication.kotlin.weight

import android.os.Bundle
import android.view.*
import android.widget.TextView
import androidx.fragment.app.DialogFragment


/**
 * Created by Min
 * Date 2022/2/25  11:11
 */
class ChooseIntentTypeDialogFragment : DialogFragment() {
    private var choosePosition = -1

//    var listener: OnCardSelectListener? = null
//
//    companion object{
//        fun newInstance(data: ArrayList<RecruitSignTypeBean>): ChooseIntentTypeDialogFragment {
//            val dialogFragment = ChooseIntentTypeDialogFragment()
//            val bundle = Bundle()
//            bundle.putParcelableArrayList("11", data)
//            dialogFragment.arguments = bundle
//            return dialogFragment
//        }
//    }
//
//    override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
//        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
//        dialog.window?.apply {
//            val attributes = this.attributes
//            attributes.gravity = Gravity.CENTER
//            attributes.width = 300
//            this.attributes = attributes
//        }
//        val view = inflater!!.inflate(R.layout.dialog_choose_intent_type, container, false)
//
//        val list = IntentHelper.getArrayList<RecruitSignTypeBean>(arguments, ComponentConstant.DATA)
//        val adapter = object : CommonAdapter<RecruitSignTypeBean>(activity, R.layout.item_recruit_intent_type, list) {
//            override fun convert(holder: ViewHolder, bean: RecruitSignTypeBean, position: Int) {
//                val tv_name = holder.getView<TextView>(R.id.tv_name)
//
//                tv_name.setOnClickListener {
//                    choosePosition = position
//                    notifyDataSetChanged()
//                }
//            }
//        }
//
//        view.rv_content.layoutManager = GridLayoutManager(activity, 4)
//        view.tv_sure.setOnClickListener {
//            listener?.chooseItem(choosePosition, list.get(choosePosition))
//        }
//
//        view.rv_content.adapter = adapter
//        return null
//    }
}

interface OnIntentTypeSelectListener {

    fun chooseItem(choosePosition: Int, entity: RecruitSignTypeBean?)
}